package projeto.model;

import java.util.ArrayList;
import java.util.List;

public class ListasDeReproducao {
	private List<ListaDeReproducao> playLists;
	
	public ListasDeReproducao(){
		playLists = new ArrayList<ListaDeReproducao>();
	}
	
	public void addListaDeReproducao(ListaDeReproducao playList) throws Exception{
		if(playLists.contains(playList)){
			throw new Exception("Esta playList ja existe no conjunto de Listas");
		}
		playLists.add(playList);
	}
	
	public void removeListaDeReproducao(ListaDeReproducao playList){
		playLists.remove(playList);
	}
	
	public ListaDeReproducao buscaListaDeReproducao(String nome) throws Exception{
		ListaDeReproducao playListBuscada = null;
		for (int i = 0; i < playLists.size(); i++){
			if (playLists.get(i).getNome() == nome){
				playListBuscada = playLists.get(i);
			}
		}
		if(playListBuscada == null){
			throw new Exception("playList nao Encontrada");
		}
		return playListBuscada;
	}
	
	
}
